<?php

namespace App\Models;



class News extends Base
{

    protected $table = 'news';

    protected $casts = [
        'news_tag' => 'array',
    ];

    public function project() {
        return $this->belongsTo(Project::class, 'project_id');
    }

    public function setNewsTagAttribute($value) {
        return $this->attributes['news_tag'] = $value;
    }

    public function getNewsTypeShowAttribute() {
        return Config::getItem($this->news_type);
    }

    public function getNewsTagShowAttribute() {
        $arr = [];
        foreach ($this->news_tag as $id) {
            $arr[] = Config::getItem($id);
        }
        return $arr;
    }


}
